<template>
    <div>
        <el-date-picker
            v-model="result"
            :type="type"
            range-separator="至"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
            :value-format="valueFormat"
            @change='change'
            clearable>
        </el-date-picker>
    </div>
</template>

<script>
    export default {
        props : {
            value : {
                type : Array,
                default : _ => []
            },
            type : {
                String,
                default : 'daterange'
            },
            valueFormat : {
                type : String,
                default : 'yyyy-MM-dd'
            }
        },
        watch : {
            value : {
                handler : function (n) {
                    this.result = n;
                }
            }
        },
        data () {
            return {
                result : []
            }
        },
        methods : {
            change () {
                this.$emit('input', this.result);
            }
        },
    }
</script>

<style lang='less' scoped>

</style>